<template>
	<view class="content">
		<view class="gradient-bg">
			<!-- 渐变背景 -->
			<view class="list-card-wrap">
				<view class="flex-row-between" style="margin-bottom: 8rpx;">
					<view class="flex-row">
						<text class="white-text font-24">任务编号</text>
						<text class="white-text font-24" style="margin-left: 20rpx;">{{form.no}}</text>
					</view>
					<view class="tag tag-gray">{{getDict(form.checkWay, checkWayList)}}</view>
				</view>
				<view class="list-card">
					<view v-if="form.checkWay=='LOCATION'" class="">
						<text class="black-text-34">{{form.storehouseNo}}</text>
					</view>
					<view class="">
						<view class="flex-row-between">
							<text class="gray-text">创建时间</text>
							<text class="gray-text">{{form.createTime}}</text>
						</view>
						<view class="flex-row-between">
							<text class="gray-text">完成时间</text>
							<text class="gray-text">{{form.completeTime}}</text>
						</view>
					</view>
				</view>
			</view>
			
			
			<view class="table-wrap">
				<uni-collapse v-if="form.checkWay == 'LOCATION' && form.checkDetailVos" ref="collapse">
					<uni-collapse-item v-for="(item,index) in form.checkDetailVos" :key="index" :title="item&&item.locationNo?item.locationNo:'--'" :open="true">
						<!-- <view> -->
							<zb-table :show-header="true" :columns="column" :fit="true" :border="true" :data="item.stockCheckResultList">
							</zb-table>
						<!-- </view> -->
					</uni-collapse-item>
				</uni-collapse>
				<uni-collapse v-if="form.checkWay == 'PRODUCT' && form.checkDetailVos" ref="collapse">
					<uni-collapse-item v-for="(item,index) in form.checkDetailVos" :key="index" :title="item&&item.productName?item.productName:'--'" :open="true">
						<!-- <view> -->
							<zb-table :show-header="true" :columns="column1" :fit="true" :border="true" :data="item.stockCheckResultList">
							</zb-table>
						<!-- </view> -->
					</uni-collapse-item>
				</uni-collapse>
			</view>
		</view>


	</view>
</template>

<script>
	import {
		getDetail
	} from "./api"
	import { getDict } from "@/utils/common"
	
	export default {
		data() {
			return {
				column: [
					{ type:'index', label: '序号', align: 'center'},
					{
						name: 'barcode',
						label: '条码',
						fixed: false,
						emptyString: '--'
					},
					{
						name: 'productName',
						label: '物料',
						emptyString: '--'
					},
					{
						name: 'qty',
						label: '数量',
						align: 'center',
						emptyString: '--'
					}
				],
				column1: [
					{ type:'index', label: '序号', align: 'center'},
					{
						name: 'barcode',
						label: '条码',
						fixed: false,
						emptyString: '--'
					},
					// {
					// 	name: 'productName',
					// 	label: '物料',
					// 	emptyString: '--'
					// },
					{
						name: 'qty',
						label: '数量',
						align: 'center',
						emptyString: '--'
					}
				],
				form:{},
				checkWayList: [],
				getDict
			}
		},
		onLoad(option){
			this.form = {...this.form,...option};
			// 获取盘点方式字典
			this.getDicts("storehouse_check_way").then(res => {
			    this.checkWayList = res.data;
			});
			this.getDetail()
		},
		methods:{
			// 获取详情数据
			getDetail(){
				getDetail(this.form.id).then(res=>{
					if (res.code == 200) {
						this.form = {...this.form, ...res.data}
						console.log(this.form)
						// if(this.form.orderStatus != 1){
						// 	this.getYardageGoodsRecordList()
						// }
					}
				})
			},
			// getYardageGoodsRecordList(){
			// 	getYardageGoodsRecordList({pageNum:1, pageSize:0,taskNo:this.form.no}).then(res=>{
			// 		if (res.code == 200) {
			// 			this.tableData = res.rows
			// 		}
			// 	})
			// },
		}
	}
</script>

<style>
	page {
		background-color: #F8F8F8;
	}
</style>
<style scoped>

</style>
